Skip to main content

Compare Signals

Overview

This test metric compares the similarity between signals using:

  1. Peak Signal - maximum absolute value of signal
  2. Mean Residual - average of differences between the signals
  3. Standard Deviation of Residual
  4. Percentage Outside Corridor - percentage of residauls that exceed defined corridor size
  5. Cosine Similarity - measures the cosine angle between the signals (treated as vectors)
  6. T-statistic - determines if the signal's residual values are significantly different from the reference signal's residuals
  7. Temporal Moment Differences - the difference in moments between the signal and reference signal
  8. Min and Max Time - represents the starting and ending time of the signal to ensure both signals are aligned in time

Required Input

  1. Signal or signals to compare to reference signal
  2. Reference signal
    • if not signal is provided, fist signal will be used as reference signal

Calculation

  1. Checks units of signal to ensure consistency and converts units if necessary
  2. Applies band-pass filter to both the input and reference signal to remove noice
  3. Signals are truncated to specified time range (if applicable)
  4. Reference Signal is calculated (if not provided)
    • If no reference signal is present, input signal is converted to a list of signals
    • Input singal is resampled to the same time step between data points
    • Signals are truncated to common time range
    • Reference signal is calculated as the average of all input signals
  5. Comparison Metrics are calculated (see steps 1-8 in overview section)
  6. Residual signal is calculated by finding the difference between the input and reference signal
  7. Two corridor signals are created
    • Standard Deviation-based Corridor: defined as the reference signal +/- the average standard deviation of the residuals
    • 90% Confidence Interval-based Corridor: based on a 90% confidence interval around the reference signal
  8. Cumulative density curves are calculated to understand the distribution of residuals
    • Data is assorted in ascending order (smalles to largest values)
    • Cumulative probability is calculated
      • Proportion of data points that are less than or equal to a particular value
    • Plot cumulative distribution function using calculated cumulative probabilites at each point
CumulativeDistribution(xi)=numerofvaluesxitotalnumberofvaluesCumulative\,Distribution\,(x_i) = \frac{numer\,of\,values \le x_i}{total\,number\,of\,values}
  1. Cross-correlation curves are calculated to understand how signals align over various time shifts
    • Input signal is "shifted" by different amounts to calculate cross correlation at various time shifts
    • Cross correlation is calculated over a range of time shifts to result in a curve showing the similarity between signal changes as input signal is shifted over time
CrossCorrelation(t)=i=1n(xixˉ)(yi+1yˉ)i=1n(xixˉ)2i=1n(yi+1yˉ)2Cross\,Correlation\,(t) = \frac{\sum_{i = 1}^{n} (x_i-\bar{x})(y_{i+1}-\bar{y})}{\sum_{i = 1}^{n} (x_i-\bar{x})^2 \sum_{i = 1}^{n} (y_{i+1}-\bar{y})^2}
  1. Output created including
    • Summary table with all comparison metrics for each signal
    • Input signals after filtering, resampling, and truncating
    • Reference signal
    • Corrdior signals with the lower and upper bounds for the corridor
    • Residual signals
    • Cumulative density curves
    • Cross-correlation curves